package com.praxinfosystems.sarthak.controllers;

import javax.annotation.Resource;
import javax.validation.Valid;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.praxinfosystems.sarthak.service.UserService;

@Controller
@RequestMapping(value = "/admin")
public class AdminController {
	
	@Resource(name="userService")
	private UserService userService;
	
	
	
	@RequestMapping(value="/checkuseravailability",method=RequestMethod.POST)
	@ResponseBody
	public String checkUserIdAvailability(String userId){
		boolean isAvailable=false;
		isAvailable=userService.checkUserAvailability(userId);
		if(isAvailable){
			return "yes";
		}else{
			return "no";
		}
	}
}
